package com.aizhixin.test.question.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.aizhixin.test.question.dto.judgeQuestionNeedDTO;
import com.aizhixin.test.question.service.JudgeAndChangeDateService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

import lombok.extern.slf4j.Slf4j;

@RestController
@RequestMapping(value="v1/open/anserQuestionJudge")
@Api(tags="回答问题API")
@Slf4j
public class judgeController {
	@Autowired
	private JudgeAndChangeDateService judgeAndChangeDateService;
	
	@PutMapping(value="/submit",produces=MediaType.APPLICATION_JSON_VALUE)
	@ApiOperation(httpMethod="PUT",value="输入userId，SteamId，UserAnser然后修改三表",
	notes="输入userId，SteamId，UserAnser然后修改三表<br><br><b>@author xixi</b>")
	public judgeQuestionNeedDTO putchangeTableTree(
			@ApiParam(value="用户Id")
			@RequestParam(required=true,value="userId") Long userId,
			
			@ApiParam(value="题目ID")
			@RequestParam(required=true,value="stamId") Long steamId,
			
			@ApiParam(value="用户答案")
			@RequestParam(required=true,value="userAnswer") String userAnser) {
			judgeQuestionNeedDTO judgeQuestionNeedDTO=new judgeQuestionNeedDTO();
			judgeQuestionNeedDTO=judgeAndChangeDateService.service(userId, steamId, userAnser);
			
		return judgeQuestionNeedDTO;
	}
}
